const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')

module.exports = {
  mode: 'production',
  output: {
    filename: '[name]-[chunkhash:8].js', // 使用chunkhash
    path: path.join(__dirname, 'dist')
  },
  plugins: [
    new CopyWebpackPlugin({
      patterns: [
        {
          from: 'public/',
          filter: async (resourcePath) => {
            return !resourcePath.match(/index.html$/)
          }
        }
      ]
    })
  ]
}
